package com.bjpowernode.result;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Builder
@NoArgsConstructor
@AllArgsConstructor
@Data
public class Result {
    private int code;
    private String msg;
    private Object info;

    public static Result OK() {
        return Result.builder().code(200).msg("请求成功").info(null).build();
    }

    public static Result OK(Object info) {
        return Result.builder().code(200).msg("请求成功").info(info).build();
    }

    public static Result FAIL() {
        return Result.builder().code(500).msg("未知错误").info(null).build();
    }

    public static Result FAIL(String msg, Object info) {
        return Result.builder().code(500).msg(msg).info(info).build();
    }

    public static Result FAIL(Object info) {
        return Result.builder().code(500).msg("未知错误").info(info).build();
    }
}
